import React, {PureComponent} from 'react';
import { Form, Input, Modal, Button, Card } from 'antd';
import moment from 'moment';
import TableList from '@/components/TableList';
import styles from '../../pages/search.less';

const FormItem = Form.Item;
const {TextArea} = Input;

// 申请详情页面，包含审核
@Form.create()
class UserTable extends PureComponent {
  constructor(props) {
    super(props);

    this.state = {
      selectedRows: [],
    };
  }

  handleUserList = (pagination) => {
    this.props.idQuery(pagination.pageSize,pagination.current-1);
  }

  render() {
    const { memberVisible, handleMemberVisible, detailsData } = this.props;
    const { selectedRows } = this.state;
    const columns = [
    {
      title: '姓名',
      dataIndex: 'userName',
    },
    {
      title: '登录名',
      dataIndex: 'userCode',
    },
    {
      title: '所属组织',
      dataIndex: 'orgName',
    }
  ];
    return (
      <Modal
        destroyOnClose
        width={800}
        title="组内人员"
        visible={memberVisible}
        onCancel={() => handleMemberVisible()}
        footer={[
          <Button key="back" type="primary" onClick={() => handleMemberVisible()}>返回</Button>
        ]}
        bodyStyle={{padding:'0'}}
      >       
        <Card bordered={false}>    
          <TableList
            className={styles.tdPadding}
            selectedRows={selectedRows}
            loading={false}
            data={detailsData}
            columns={columns}
            onChange={this.handleUserList.bind(this)}       
            hideRowSelection={true}
            rowKey={record => record.userId}
          />
        </Card>    
      </Modal>
    );
  }
}

export default UserTable;
